﻿using Swimj.DomainLib.Entities;

namespace Production.DomainLib.AggregatesModel.ProductionResourceAggregate
{
    public class ProductionResource : AuditableAggregateRoot<int>
    {
        /// <summary>
        /// 资源编码
        /// </summary>
        public string? Code { get; set; }

        /// <summary>
        /// 资源名称
        /// </summary>
        public string? Name { get; set; }

        /// <summary>
        /// 是否资源组
        /// </summary>
        public bool? IsResourceGroup { get; set; }

        /// <summary>
        /// 是否停用资源组
        /// </summary>
        public bool? IsStopGroup { get; set; }

        /// <summary>
        /// 资源类别
        /// </summary>
        public int? ResourceCategory { get; set; }

        /// <summary>
        /// 最大负荷
        /// </summary>
        public double MaxLoad { get; set; }

        /// <summary>
        /// 流水线间隔
        /// </summary>
        public double PipelineInterval { get; set; }

        /// <summary>
        /// 空闲时间
        /// </summary>
        public double IdleTime { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public double Quantity { get; set; }

        public int Sort { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        public string? Description { get; set; }

        public ProductionResource()
        {
        }

        public ProductionResource(string? code, string? name, bool? isResourceGroup, bool? isStopGroup,
            int? resourceCategory, double maxLoad, double pipelineInterval, double idleTime, double quantity,
            int sort, string? description) : this()
        {
            Code = code;
            Name = name;
            IsResourceGroup = isResourceGroup;
            IsStopGroup = isStopGroup;
            ResourceCategory = resourceCategory;
            MaxLoad = maxLoad;
            PipelineInterval = pipelineInterval;
            IdleTime = idleTime;
            Quantity = quantity;
            Sort = sort;
            Description = description;
        }

        public void Update(string? code, string? name, bool? isResourceGroup, bool? isStopGroup,
            int? resourceCategory, double maxLoad, double pipelineInterval, double idleTime, double quantity,
            int sort, string? description)
        {
            Code = code;
            Name = name;
            IsResourceGroup = isResourceGroup;
            IsStopGroup = isStopGroup;
            ResourceCategory = resourceCategory;
            MaxLoad = maxLoad;
            PipelineInterval = pipelineInterval;
            IdleTime = idleTime;
            Quantity = quantity;
            Sort = sort;
            Description = description;
        }
    }
}